<html class="ng-scope">
<head>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta content="telephone=no" name="format-detection">
    <title>酒水寄存</title>
    <link data-turbolinks-track="true" href="{RES}/mobile/{php echo $this->cur_tpl}/assets/diandanbao/weixin.css" media="all" rel="stylesheet">
    <link rel="stylesheet" href="{php echo $this->cur_mobile_path}/mvalidate/validate.css" />
    <script src="{php echo $this->cur_mobile_path}/script/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="{php echo $this->cur_mobile_path}/mvalidate/jquery-mvalidate.js" ></script>
    <!--<style type="text/css">-->
        <!--@charset "UTF-8";-->
        <!--[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak, .ng-hide:not(.ng-hide-animate) {-->
            <!--display: none !important;-->
        <!--}-->

        <!--ng\:form {-->
            <!--display: block;-->
        <!--}-->

        <!--@media screen {-->
            <!--.smnoscreen {-->
                <!--display: none-->
            <!--}-->
        <!--}-->

        <!--@media print {-->
            <!--.smnoprint {-->
                <!--display: none-->
            <!--}-->
        <!--}-->
    <!--.footer-bar.bar-tab .tab-item.active .icon, .bar-tab .tab-item:active .icon {-->
    <!--color: {$setting['style_base']};-->
    <!--}-->
    <!--.footer-bar.bar-tab .tab-item.active, .bar-tab .tab-item:active {-->
    <!--color: {$setting['style_base']};-->
    <!--}-->
    <!--</style>-->
    <style>
        .food-number {
            color: white;
            background-color: #ff5040;
            border-radius: 1000px;
            width: 100px;
            height: 100px;
            margin: 5px auto;
            text-align: center;
            line-height: 50px;
            padding: 25px 0;
            box-sizing: border-box;
            font-size: 38px
        }
        .food-number-hint {
            font-size: 14px;
            text-align: center;
            line-height: 1.5em;
            color: #444;
        }
        .line-items-section,.order-info-section {
            background-color: white;
            border-top: 1px solid #eeeeee;
            border-bottom: 1px solid #eeeeee;
            margin-bottom: 10px
        }

        .line-items-section .item,.order-info-section .item {
            padding: 5px 10px;
            font-size: 14px;
            border-bottom: 1px dashed #eeeeee
        }
        .order-info-section .value {
            float: right;
            color: #999999
        }
    </style>
</head>
<body>
<div style="height: 100%;" class="ng-scope">
    <div id="queue-index-page" class="ng-scope">
        <div class="ddb-nav-header" style="background-color: {$setting['style_base']};border-bottom: 1px solid {$setting['style_base']};">
            <div class="nav-left-item" onclick="location.href='{php echo $this->createMobileUrl('detail', array('id' => $storeid), true)}';"><i class="fa fa-angle-left"></i></div>
            <div class="header-title ng-binding">酒水寄存</div>
            <div class="nav-right-item">
                <div class="operation-button" onclick="postmain();" style="color: #fff;">提交</div>
            </div>
        </div>
        <div class="main-view">
            <div class="space-12"></div>
            <div class="food-number-section ng-scope" style="margin-bottom: 10px;padding: 10px;background-color: white">
                <div class="food-number" >
                    <span class="number ng-binding">{$table['title']}</span><br>
                </div>
                <!--<div class="food-number-hint">餐台号</div>-->
            </div>
            <div class="section" id="new-guest-queue-section">
                <div class="list-item ddb-form-control ng-scope" style="display: none;">
                    <div class="ddb-form-label">物品名称</div>
                    <div style="display: inline-block;width: 70%;">
                    {loop $category $item}
                    <select style="width: 60%;" name="cate_name_{$item['id']}">
                        <option value="0">
                            {$item['name']}
                            {if $item['savewinetime']>0}
                            (期限{$item['savewinetime']}天)
                            {/if}
                            ∨
                        </option>
                        {loop $goodslist[$item['id']]['goods'] $goods}
                        <option value="{$goods['id']}">
                            {$goods['title']}
                        </option>
                        {/loop}
                    </select>
                    <input type="text" class="ddb-form-input "
                           name="cate_count_{$item['id']}" placeholder="填输入数量"  style="width: 40%;"><br/>
                    {/loop}
                    </div>
                </div>
                <div class="list-item ddb-form-control ng-scope">
                    <div class="ddb-form-label">姓名</div>
                    <input type="text" class="ddb-form-input ng-pristine ng-untouched ng-valid" id="username" name="username" placeholder="填写姓名">
                </div>
                <div class="list-item ddb-form-control ng-scope">
                    <div class="ddb-form-label">手机号</div>
                    <input type="number" class="ddb-form-input ng-pristine ng-untouched ng-valid" id="usermobile" name="usermobile" placeholder="填写手机号">
                </div>
                <input type="hidden" id="tablesid" value="{$tablesid}" name="tablesid">
                <div class="space"></div>
            </div>
        </div>
    </div>
</div>
<script>
    function postmain() {
        var url = "{php echo $this->createMobileUrl('setsavewine', array('storeid' => $storeid), true)}";
        var username = $("#username").val();
        var tablesid = $("#tablesid").val();
        var usermobile = $("#usermobile").val();
        var storeid = "{$storeid}";

        var title = $("#title").val();

//        if (title == "") {
//            $.mvalidateTip('请输入物品名称!');
//            return false;
//        }
        if (username == "") {
            $.mvalidateTip('请输入姓名!');
            return false;
        }
        if (usermobile == "") {
            $.mvalidateTip('请输入手机号码!');
            return false;
        }
        data = {
            "tablesid" : tablesid,
            "usermobile": usermobile,
            "username": username,
            "title":title,
            "storeid":storeid
        };
        {loop $category $item}
        data["cate_name_{$item['id']}"] = $("select[name='cate_name_{$item['id']}']").val();
        data["cate_count_{$item['id']}"] = $("input[name='cate_count_{$item['id']}']").val();
        {/loop}

        $.ajax({
            url: url, type: "post", dataType: "json", timeout: "10000",
            data: data,
            success: function (data) {
//                $.mvalidateTip(data.msg);

                if (data.status == 1) {
                    location.href='{php echo $this->createMobileUrl('savewinelist', array(), true)}';
                } else {
                    $.mvalidateTip(data.msg);
                }
            },error: function () {
                $.mvalidateTip("网络不稳定，请重新尝试!");
            }
        });
    }
</script>
</body>
</html>